package com.vm.dao.system;

import java.util.List;
import java.util.Map;

import com.vm.dao.BaseDAOImpl;
import com.vm.entity.User;

public class UserDAOImpl extends BaseDAOImpl<User, String> implements IUser {

	public UserDAOImpl() {
		setEntityClass(User.class);
	}

	public boolean validator(String loginname) {
		Object[] params = new Object[] { loginname };
		String hql = " from User as user where user.signNm=?";
		boolean falg = super.validator(hql, params);
		return falg;
	}

	public User validator(String name, String pwd) {
		Object[] params = new Object[] { name, pwd };
		String hql = " from User as user where user.signNm=? and user.userPw = ? and vldMrk=1";
		System.out.println(hql);
		User result = findBySingleObject(hql, params);
		System.out.println(hql);
		return result;
	}

	public List<Map<String, Object>> findAllAgency() {
		String hql = "select orgNo as id,suprOrgNo as  pId,orgNm as name, arGrp as arGrp FROM Agency ";
		return super.findBySqlALL(hql, null);
	}
}
